package com.ruoyi.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.domain.CourseOrders;
import com.ruoyi.business.mapper.CourseOrdersMapper;
import com.ruoyi.business.service.ICourseOrdersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

@Service
public class CourseOrdersServiceImpl extends ServiceImpl<CourseOrdersMapper, CourseOrders> implements ICourseOrdersService {

    @Resource
    CourseOrdersMapper courseOrdersMapper;

    @Override
    public List<CourseOrders> getCourseOrdersList(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersList(courseOrders);
    }

    @Override
    public List<CourseOrders> getCourseOrdersListByType(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersByType(courseOrders);
    }

    @Override
    public List<CourseOrders> getCourseOrdersListByStatus(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersByStatus(courseOrders);
    }

    @Override
    public List<CourseOrders> getCourseOrdersByUser(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersByUser(courseOrders);
    }

    @Override
    public List<CourseOrders> getCourseOrdersByCourse(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersByCourse(courseOrders);
    }

    @Override
    public List<CourseOrders> selectCourseOrderByTime(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrderByTime(courseOrders);
    }

    @Override
    public List<CourseOrders> selectCourseOrdersByUserId(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrdersByUserId(courseOrders);
    }

    @Override
    public List<CourseOrders> selectCourseOrdersByUserIdAndCourseId(Long courseId, Long[] userIds) {
        System.out.println("课程Id: " + courseId + ",客户Id集合：" + Arrays.toString(userIds));
        return courseOrdersMapper.selectCourseOrdersByUserIdAndCourseId(courseId, userIds);
    }

    @Override
    public void deleteBatchByCourseIds(Long[] courseIds) {
        courseOrdersMapper.deleteBatchByCourseIds(courseIds);
    }

    public void deleteBatchByUserIds(List<Long> userIds) {
        courseOrdersMapper.deleteBatchByUserIds(userIds);
    }

    @Override
    public CourseOrders getCourseOrdersById(Long id) {
        return courseOrdersMapper.selectCourseOrdersById(id);
    }

    @Override
    public int insertCourseOrders(CourseOrders courseOrders) {
        return courseOrdersMapper.insertCourseOrders(courseOrders);
    }

    @Override
    public int updateCourseOrders(CourseOrders courseOrders) {
        return courseOrdersMapper.updateCourseOrders(courseOrders);
    }

    @Override
    public CourseOrders getCourseOrderById(CourseOrders courseOrders) {
        return courseOrdersMapper.selectCourseOrderById(courseOrders);
    }
}
